home *** CD-ROM | disk | FTP | other *** search
/ Programming an RTS Game with Direct3D / Programming an RTS Game with Direct3D.iso / Examples / Chapter 12 / Example 12.5 / mouse.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-06-30  |  983 b   |  51 lines

  1. #ifndef _MOUSE
  2. #define _MOUSE
  3.  
  4. #include <d3dx9.h>
  5. #include <dinput.h>
  6. #include "debug.h"
  7. #include "intpoint.h"
  8. #include "mesh.h"
  9. #include "terrain.h"
  10.  
  11. struct RAY{
  12.     RAY();
  13.     RAY(D3DXVECTOR3 o, D3DXVECTOR3 d);
  14.  
  15.     //Our different intersection tests
  16.     float Intersect(MESHINSTANCE iMesh);
  17.     float Intersect(BBOX bBox);
  18.     float Intersect(BSPHERE bSphere);
  19.     float Intersect(ID3DXMesh* mesh);
  20.  
  21.     D3DXVECTOR3 org, dir;
  22. };
  23.  
  24.  
  25. class MOUSE : public INTPOINT{
  26.     friend class CAMERA;
  27.     public:
  28.         MOUSE();
  29.         ~MOUSE();
  30.         void InitMouse(IDirect3DDevice9* Dev, HWND wnd);
  31.         bool ClickLeft();
  32.         bool ClickRight();
  33.         bool WheelUp();
  34.         bool WheelDown();
  35.         bool Over(RECT dest);
  36.         bool PressInRect(RECT dest);
  37.         void Update();
  38.         void Paint();
  39.         RAY GetRay();
  40.  
  41.     private:
  42.         IDirect3DDevice9* m_pDevice;
  43.         LPDIRECTINPUTDEVICE8 m_pMouseDevice;
  44.         DIMOUSESTATE m_mouseState;
  45.         IDirect3DTexture9* m_pMouseTexture;
  46.         LPD3DXSPRITE m_pSprite;
  47.         RECT m_viewport;
  48. };
  49.  
  50.  
  51. #endif